﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using Ext.Net;

namespace KamLib.Controls
{
    public class PageHeader : Group
    {

        [DefaultValue("page-header")]
        public override string Cls
        {
            get { return ViewState.Try("Cls", "page-header"); }
            set { base.Cls = value; }
        }

        public string Description { get; set; }

        [DefaultValue("HBox")]
        public override string Layout
        {
            get { return ViewState.Try("Layout", "HBox"); }
            set { base.Layout = value; }
        }

        [DefaultValue("10px 0 20px 85px")]
        public override string PaddingSummary
        {
            get { return ViewState.Try("PaddingSummary", "10px 0 20px 85px"); }
            set { base.PaddingSummary = value; }
        }

        protected override void CreateChildControls()
        {
            if (ChildControlsCreated) return;
            ChildControlsCreated = true;

            var desc = new Text
            {
                Cls = "body-wrap header-panel column3",
                Flex = 1,
                Html = @"<div class=""page-icon " + IconCls + @"""></div>" + Description,
            };
            Items.Insert(0, desc);

            IconCls = null;
        }
    }
}
